<!DOCTYPE html>
{assign name="pn" value="user/home" }
<html>
<head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" />
    <meta name="renderer" content="webkit|ie-comp|ie-stand" />
    <title>个人中心-酷代码</title>
    <meta name="baidu-site-verification" content="code-xEvBW4PmsD" />
    <meta name="keywords" content="代码,代码分享,代码例子,源码,java代码，javascript代码,最代码,好例子,程序" />
    <meta name="description" content="酷代码,专业的源代码分享网站,聚合高质量的java/jquery/bootstrap/html/css/php/python源代码" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
    <script src="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.4.1/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/min/?g=css&v={:version}">
    <script src="https://cdn.bootcdn.net/ajax/libs/layer/3.5.1/layer.min.js"></script>
</head>
<body>

{include file="inc/header" /}

<div class="container">

    <div class="row">
        <div class="col-md-9 ecol">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">我的信息</h3>
                    <!--<a class="more52" href="/code.html">更多</a>-->
                </div>
                <div class="panel-body">

                    <div>硬币：{$user.coin}</div>
                    <div>
                        {if $user.email_ack==0 }
                        邮箱：<input id="tx1" type="text" value="{$user.email}"><button id="bt1" class="btn btn-default">发送验证码</button><br>
                        验证码：<input id="tx2" type="text"><button id="bt2" class="btn btn-success">验证</button><br>
                        {else}
                        邮箱：{$user.email}（已验证）
                        {/if}
                    </div>

                    <div style="border: 1px solid darkorange;margin: 20px;padding: 10px;">
                        邀请新用户可获得硬币。专属链接：{:BASE_URL}?shareId={$user.id}<br>
                    </div>


                </div>

            </div>

        </div>
        <div class="col-md-3 ecol">
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">最新发布</h3>
                </div>
                <div class="panel-body">

                </div>
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <h3 class="panel-title">硬币攻略</h3>
                </div>
                <div class="panel-body">
                    <span style="color:#fd1818;">如何获得硬币：</span><br>
                    1. 发表资源可以获得硬币奖励。<br>
                    2. 资源被下载可获得硬币收益。<br>
                    3. 精品资源额外获得硬币奖励。<br>
                    新用户注册 +10硬币<br>
                    验证邮箱 +10硬币<br>
                    邀请新用户 +10硬币<br>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    var sec = 30;
    $(function (){
        $('#bt1').click(function (){
            if (sec < 30) {
                return;
            }

            var btn1 = $(this);
            btn1.attr('disabled', 'disabled');
            var fun = function () {
                btn1.text('发送验证码（'+sec+'）');
                sec--;
                if (sec <= 0) {
                    btn1.text('发送验证码');
                    btn1.removeAttr('disabled');
                    clearInterval(timer);
                    sec=30;
                }
            };
            fun();
            var timer = setInterval(fun, 1000);
            $.ajax({
                url:'/user/email/ack',
                type : "POST",
                data:{
                    email:$('#tx1').val()
                },
                dataType:'json',
                success:function(res){
                    var data = JSON.parse(res);
                    console.log(data);
                    layer.alert(data.msg)
                }
            })
        });
        //激活
        $('#bt2').click(function (){

            $.ajax({
                url:'/user/email/active',
                type : "POST",
                data:{
                    code:$('#tx2').val()
                },
                dataType:'json',
                success:function(res){
                    var data = JSON.parse(res);
                    console.log(data);
                    layer.alert(data.msg)
                    if (data.code == '200') {
                        location.reload();
                    }
                }
            })
        });
    })
</script>
{include file="inc/footer" /}
</body>
</html>
